<!--基础表格-->
<template>
    <div class="base-iframe">
          <iframe ref="iframe" frameborder="0"
              name="showHere"
              scrolling="no"
              src="http://dx.anywellchat.com:8888/anywell_hylingls/listbillnew.html?a=1"
              style="width: 100%;height: 580px;"></iframe>
    </div>

</template>

<script>
// import TreeList from './TreeList'
export default {
    name: 'FilterIframe',
    // components: {
    //     TreeList
    // },
    data () {
        return {
            iframeWin: {}
        }
    },
    props: {
        msg: {
            a: 1,
            b: 2
        },
        dd: {
            type: Object,
            default: () => {
                return {}
            }
        }
    },
    created () {

    },
    computed: {

    },
    mounted () {
        // iframe的对象
        window.addEventListener('message', this.handleMessage)
        setTimeout(() => {
            console.log(222)
            console.log('this.$refs.iframe', this.$refs.iframe)
        }, 5000)
        this.iframeWin = this.$refs.iframe
    },
    methods: {
        // 接收子页面信息
        handleMessage (event) {
            this.$refs.iframe.contentWindow.postMessage(this.msg)
            this.$api.datacont.getTreeList().then(res => {
                this.tree.treeData = data.list
            })
            if (event.type === 'loaded') {
                this.$refs.iframe.contentWindow.postMessage(this.msg)
            }
            const data = event.data.data
            if (data.info === 'success') {
                console.log(data.data)
                this.$emit('getIframeMsg', false)
                // 执行刷新表格操作
            }
        }
    }
}
</script>

<style lang="less">
</style>
<style scoped lang="less">

</style>
